UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oq49fj+8x6rym5FVpPgQlfQdn64Hljq1ePDi8gQllTw=' 
WHERE 
  key_id = '49fbe4a67ce2ee8be80573c9220574fd7fd86b272b5699b20d163d5f618ee43f' 
  AND (
    token = 'oq49fj+8x6rym5FVpPgQlfQdn64Hljq1ePDi8gQllTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053