UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xIvRD3k3qmZcR8nzjrU2BKXkoboBPxNR9zyPprjB9ls=' 
WHERE 
  key_id = '24dfe0345131949fcd409c42c92adce3240638b8d8f808b61288bf07408e7f8f' 
  AND (
    token = 'xIvRD3k3qmZcR8nzjrU2BKXkoboBPxNR9zyPprjB9ls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031