UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5f1AIvR5WhnnX62DQUeqv/WJPsgxPvDwuedUTtC+dOg='
WHERE
key_id = '8a0842fd81a95cfb7ad5dd0c84a38b2cc8e4af31829433ba2c1e9bd74ccf6769'
AND (
token = '5f1AIvR5WhnnX62DQUeqv/WJPsgxPvDwuedUTtC+dOg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)