UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4NyrqbE1ti0MXQ2oGEwXjtQumcc+hkoDlmKJbtvjgzI='
WHERE
key_id = 'c0071d117e7bb7215a1c2bc0fa8b962b873498a301afea526eb946d40a6479cc'
AND (
token = '4NyrqbE1ti0MXQ2oGEwXjtQumcc+hkoDlmKJbtvjgzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)