UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6cd4rSDJreTrrt0F8+BaG27OBU8oYca1saPaFs+esyQ='
WHERE
key_id = '32169786c8f2764cb3cefb76b4d129275e9ebcc0ea81165289281c145c59d7f5'
AND (
token = '6cd4rSDJreTrrt0F8+BaG27OBU8oYca1saPaFs+esyQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)