UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJA9yObkJn4T5n2P0FFgadrRjUK32kmvXwc4N4F49+c='
WHERE
key_id = 'e580da82d4e6b2221bc1ccfec7acbd439fca9b702b03dd7fb78f0a362817961c'
AND (
token = 'bJA9yObkJn4T5n2P0FFgadrRjUK32kmvXwc4N4F49+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)