UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W1HeZrTyE1XTerjSJZFd9zGfGggEEgPktPe/c8d5C18='
WHERE
key_id = 'ec71577ce2c9f282924e7473ac91af019a2a686ac1acabc38dd1cb05c6ea08b5'
AND (
token = 'W1HeZrTyE1XTerjSJZFd9zGfGggEEgPktPe/c8d5C18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)