UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OicB+rnumF2da4m6+IZAMarTE9bwVisF1rnvhAof6YQ=' 
WHERE 
  key_id = '1def56ccf41d099d0087e1944418bb476a1cd5570b00e788b0b29f93c0a321f3' 
  AND (
    token = 'OicB+rnumF2da4m6+IZAMarTE9bwVisF1rnvhAof6YQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031