UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cM5Tgx0ye7N8FwdRVdb2f6loXlf6cxVXXgy3YbCSnUE=' 
WHERE 
  key_id = '76e72ba8f077f4743ae800839f6a68561396f0789cfa165e4e6ba1e37ee9d16a' 
  AND (
    token = 'cM5Tgx0ye7N8FwdRVdb2f6loXlf6cxVXXgy3YbCSnUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038