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