UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iJ6oBXILEq6C56zFgjEGWBtoycUxU4j4vOZQ8Mia9UA='
WHERE
key_id = 'dd8c6cc232321b8075b9f5492b048da77e802b0f15f24f2c87aaa61b95b8b54b'
AND (
token = 'iJ6oBXILEq6C56zFgjEGWBtoycUxU4j4vOZQ8Mia9UA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)