UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dCPdZV2fgLMzh4+5AiHi6qZwkTEk44mCBg6w0f4I8m8='
WHERE
key_id = '9c0d1278c45cee50153a56906f791e7867ba7ff8f46eb981b635787bb5fd2856'
AND (
token = 'dCPdZV2fgLMzh4+5AiHi6qZwkTEk44mCBg6w0f4I8m8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)