UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AbKIMDWIg45jyO6aKHKZoyIWdqhXceL2t6TeE452AVg='
WHERE
key_id = '1f83b558e99c7587ab5751b55d23b1aa4041b69daa447bc63511df762c234955'
AND (
token = 'AbKIMDWIg45jyO6aKHKZoyIWdqhXceL2t6TeE452AVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)