UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kNv1wXoru8Fc9yvMDbbyW2hMzPc2Z11moPKcij6pmH4='
WHERE
key_id = '0c1d5fd3b5c8c5da70835bbc27299222a3b1a1af2633a5de86c0f27cb9016314'
AND (
token = 'kNv1wXoru8Fc9yvMDbbyW2hMzPc2Z11moPKcij6pmH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)