UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uj7KlufTNO3AAhiNlZbjAgqkttzVED9ZM0fNWUlBOiA=' 
WHERE 
  key_id = 'c22b2c5d55cd0efc1d161bad937ba17b3a5069bb852a908ef540d6f0152f5c2a' 
  AND (
    token = 'Uj7KlufTNO3AAhiNlZbjAgqkttzVED9ZM0fNWUlBOiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017