UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'amJajnodKD6MbEVMPw3hhZiyK0eI+zTqcnCETSM3xxk=' 
WHERE 
  key_id = 'a005b60799dea61adbe1b1a6b273457157274f958edc9bfa7eaef81968c166a0' 
  AND (
    token = 'amJajnodKD6MbEVMPw3hhZiyK0eI+zTqcnCETSM3xxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034