UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CMAma9cc+QUl+S9jtLgIc9xw3DvSqIc5qxLDF13jlaE='
WHERE
key_id = 'da7a45ee9839ea7ec28d817d9a790383afcdf14d0866c0c06053ad3344373127'
AND (
token = 'CMAma9cc+QUl+S9jtLgIc9xw3DvSqIc5qxLDF13jlaE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)