UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WRUbbLjhR77y+S4gYWdfrfvc1EtlkmEHmZMsrSEapP4=' 
WHERE 
  key_id = 'dfa5e37e84c5c788e684519b78992a398bdb1ae3603a9f7e8d82b16eafb6ddae' 
  AND (
    token = 'WRUbbLjhR77y+S4gYWdfrfvc1EtlkmEHmZMsrSEapP4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034