UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I2zcgK3EAOfNUNN6XQvZeFtQxaomRkPAyOr/hFEObY0='
WHERE
key_id = '789110e9a524e7b25366502e06c375482da855385f724e4f450e6227f8cccdf0'
AND (
token = 'I2zcgK3EAOfNUNN6XQvZeFtQxaomRkPAyOr/hFEObY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)