UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qQwWw6wPNiqCT6ZeiQKTReX8O7HsSdfpzJK30n1mrR0='
WHERE
key_id = '7797a4a726287b1899ca54e5b473b75c6aed1876c64f6c5c16dd5cf1345eab3f'
AND (
token = 'qQwWw6wPNiqCT6ZeiQKTReX8O7HsSdfpzJK30n1mrR0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)