UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CgvDcWoe4h2hWZSKq1Zoemn+9WMPd+41l4poERrYLy4=' 
WHERE 
  key_id = 'bf1946d48d3ae6599edec87ec14f543db94c80123f3d2a2df28ab7bfb2416770' 
  AND (
    token = 'CgvDcWoe4h2hWZSKq1Zoemn+9WMPd+41l4poERrYLy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080