UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'litDdlKuAzsvdZD+SmNUALHUdGgSVakeyGwv2w6Bc8I='
WHERE
key_id = '04996db6947042e6a2a93fe91cd342b7e30fe2f3a4d58c60aa479491a34a1029'
AND (
token = 'litDdlKuAzsvdZD+SmNUALHUdGgSVakeyGwv2w6Bc8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)