UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gyIHsfh+6vlws0x4bIl+v2HlO1wdD4SB2EUDDp53RCg='
WHERE
key_id = 'f404e16b09a74b4f38834fca6c325ddaff6aa84397edd93c49c00450fe09bc6e'
AND (
token = 'gyIHsfh+6vlws0x4bIl+v2HlO1wdD4SB2EUDDp53RCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)