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

Query time 0.00026