UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gx6k1YXMhm/h23/xrFvel8Xh4zL6crjkDs73kmobu9Q='
WHERE
key_id = 'f59e9ff73efeaeddeb34f0d9162866078dc80569e23e4d0f4da95a80c5c2c679'
AND (
token = 'gx6k1YXMhm/h23/xrFvel8Xh4zL6crjkDs73kmobu9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)