UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QBh86vdlr+it26gV0V124ZWK1u1fHZjyc967HYjBD2I=' 
WHERE 
  key_id = 'a132466d63480522a4a11130e292fda548dd3bad1e2053edfc5056b1038ab19e' 
  AND (
    token = 'QBh86vdlr+it26gV0V124ZWK1u1fHZjyc967HYjBD2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045