UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'weIXvvmnkvGgD2rEz9ztx/Al0GA43mepQAk8W5d0vfM=' 
WHERE 
  key_id = '0c2f6a6bc9601fadddc466349722d1d9489354f422efd810dd14e1e90441c5c1' 
  AND (
    token = 'weIXvvmnkvGgD2rEz9ztx/Al0GA43mepQAk8W5d0vfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028