UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/CK3V6dhKXAf3QiFkhlmfOIfZoYB0GefasXsBim/DBM='
WHERE
key_id = '1f8c67dc7ce723342357f16e084f66d3728f8296b5199ba388f3fb28311a1838'
AND (
token = '/CK3V6dhKXAf3QiFkhlmfOIfZoYB0GefasXsBim/DBM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)