UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kSdBVTy0i/w9aqZZrWKI80lslXpc+3zsr/Y5S0seXv4='
WHERE
key_id = 'a1e92fabc8065b83442b647e1bc0e05ddc83e76ec3fe79ff59a997778d23ac83'
AND (
token = 'kSdBVTy0i/w9aqZZrWKI80lslXpc+3zsr/Y5S0seXv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)