UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cdVcjH0pPAQO4xYZaFfD0jFwHScRN1Q2OUQkyNiix6E='
WHERE
key_id = 'c0d06eaaf4b21817086b13ed8e9b3ad9d5109ee3a8876c5359ef6b6573a22f75'
AND (
token = 'cdVcjH0pPAQO4xYZaFfD0jFwHScRN1Q2OUQkyNiix6E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)