UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mRf/AvpaJfUokHuZ1vzc+YaeDA7cUgE33Q4LjiuyvGM=' 
WHERE 
  key_id = '580be565a0ba690f7f5b5ae9cb9fb06ed7b0a32ce002864ca082f448c959ea80' 
  AND (
    token = 'mRf/AvpaJfUokHuZ1vzc+YaeDA7cUgE33Q4LjiuyvGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017