UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nCzNTzD29j2toscHAwlSwVQxtzNp3to+WfMRD02jX5o='
WHERE
key_id = 'a7c3625cf0a31b53e0868ef9c5c0838b7972be4965594275178fa5480b91f1bd'
AND (
token = 'nCzNTzD29j2toscHAwlSwVQxtzNp3to+WfMRD02jX5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)