UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hypvGNV1zAHV/aiD6Hhh2c9h454U1goa5JmpA5lA0BY='
WHERE
key_id = 'd3b55afa6720204147460dd15e7d67b1b1b05a0f6c67431d45d7f0791f16e7f6'
AND (
token = 'hypvGNV1zAHV/aiD6Hhh2c9h454U1goa5JmpA5lA0BY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)