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