UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pn1QNhQdmXnodtxpEfOL5iSjtXcBXE57lBP+FnsUkTw='
WHERE
key_id = 'dbf83e886d4104e58501fecb6cc47f902d65602eba33351e03ec9d3e0fb51bfc'
AND (
token = 'pn1QNhQdmXnodtxpEfOL5iSjtXcBXE57lBP+FnsUkTw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)