UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CWSEqk/uhqXKEuty+N8ZKjqZvdeYHV6bg7RknGhHElk='
WHERE
key_id = '24684761325ec620cfe3f95a65e9d2a21da684dab2e7d4dfbacfa21b32298fab'
AND (
token = 'CWSEqk/uhqXKEuty+N8ZKjqZvdeYHV6bg7RknGhHElk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)