UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tnWATRjIh9oCOmbN35P2Qe18Ja3aNxZm/Kz9hCeJMhU=' 
WHERE 
  key_id = '6de6643f15082626b2478839e4ad2ee3faba42dd5b7b426a48a57ab9860effb6' 
  AND (
    token = 'tnWATRjIh9oCOmbN35P2Qe18Ja3aNxZm/Kz9hCeJMhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057