UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MFtewkGu5XylIlDnskHnM2D4S9YbYGna2JwH/CaoWbM=' 
WHERE 
  key_id = '5ca51983cb1847bdbb7fb04b61110662ec309130f1379980ed818bcec6576818' 
  AND (
    token = 'MFtewkGu5XylIlDnskHnM2D4S9YbYGna2JwH/CaoWbM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026