UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NwFUPjzRYEDbMzd0t3704hNdAEcobO86UKfkiwij+cc='
WHERE
key_id = 'cf2a8326383cfe21411749592d46f3577d4e61d35e41773912792a408ecae02b'
AND (
token = 'NwFUPjzRYEDbMzd0t3704hNdAEcobO86UKfkiwij+cc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)