UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '12CLPB2VqZQ3QyWYYRF8miMOYjQmgavRaV+r2ha5C3A='
WHERE
key_id = 'c2aff1ea4cf096c8a1167941a34ed5b28b8d96ae4276f2344e4b6d2da15380d5'
AND (
token = '12CLPB2VqZQ3QyWYYRF8miMOYjQmgavRaV+r2ha5C3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)