UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Os5SPhLLysRiFoZyFWFniWmQlbm/YBvHdnSbQ48msvQ='
WHERE
key_id = 'a5a3f422174f91a8b0b44e34657c7262e5e0bef9cbc1a7d34960777ff640a602'
AND (
token = 'Os5SPhLLysRiFoZyFWFniWmQlbm/YBvHdnSbQ48msvQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)