UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1badSbn1JYDmBPlYcG85k1ZSwaR5aptmC3jh8csVHgg='
WHERE
key_id = '2ea7b278b709c513e617289358867779d8a5c11e3036fcd8352a6a35ad75a01a'
AND (
token = '1badSbn1JYDmBPlYcG85k1ZSwaR5aptmC3jh8csVHgg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)