UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yLlc5gmK68tL8gnyiNtsTcjZSnXxPgJTwV6j34HTouE='
WHERE
key_id = '094eaa7077acd0b25d6ef244b989683076bacfbc27511628f435239fc180e286'
AND (
token = 'yLlc5gmK68tL8gnyiNtsTcjZSnXxPgJTwV6j34HTouE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)