UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RVySIwbHDrtjUCtvX/SXCS4Yfqwy3dowmVa/5P41lVQ=' 
WHERE 
  key_id = 'b57b69608ecd19b28313ff5e94a187d4a2cf31631a1f5a881474e85fe53aca78' 
  AND (
    token = 'RVySIwbHDrtjUCtvX/SXCS4Yfqwy3dowmVa/5P41lVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030