UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QYfk9xKTve67m1gYtmbtoRGWUFidhwggtatnq+Q7KEM='
WHERE
key_id = '5411d3fe99906b0a77725e9af762fb3010f2d556f85d8b425638db055919dee5'
AND (
token = 'QYfk9xKTve67m1gYtmbtoRGWUFidhwggtatnq+Q7KEM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)