UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HjCGjG+vIRmtH1K7R5FDpyYkyzF+vVpTA0eBf+fgBRw='
WHERE
key_id = '8bbe5840eb6344dfcd407dad66570cb3f1b284d62c5fb824a305285e32c508e0'
AND (
token = 'HjCGjG+vIRmtH1K7R5FDpyYkyzF+vVpTA0eBf+fgBRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)